<!--复制自member-list,重命名啊，测试完删除-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>会员管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <link rel="stylesheet" href="css/font.css">
  <link rel="stylesheet" href="css/xadmin.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="js/xadmin.js"></script>
  <script type="text/javascript" src="js/cookie.js"></script>
</head>
<body>

<div style="margin-left: 5rem;margin-top: 1rem;margin-bottom: 0.5rem">
  快递编号：
  <div class="layui-inline">
    <input class="layui-input" name="id" id="id" autocomplete="off"/>
  </div>
  寄件人：
  <div class="layui-inline">
    <input class="layui-input" name="consignor" id="consignor" autocomplete="off"/>
  </div>
  <button class="layui-btn" data-type="reload" onclick="reload()">搜索</button>
</div>
<table class="layui-hide" id="Member" lay-filter="Member"></table>

<script type="text/html" id="memberToolbar">
  <div class="layui-btn-container">
    <button class="layui-btn layui-btn-sm" lay-event="LookExpress">查看信息</button>
    <button class="layui-btn layui-btn-sm" lay-event="ReLoadTable">刷新</button>
    <button class="layui-btn layui-btn-sm" lay-event="AddExpress">发货</button>

  </div>
</script>

<script src="../layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->

<script>

  layui.use('table', function () {
    var table = layui.table;
    var $ = layui.jquery, upload = layui.upload;

    table.render({
      elem: '#Member',
      headers: {
        AccessKey: "1465465dfsafsdfhefas",
        AccessSecret: "645SDSAGBDFBasaasdsa"
      }
      , url: 'http://localhost:8081/Express/getAddExpressList'
      , toolbar: '#memberToolbar' //开启头部工具栏，并为其绑定左侧模板
      , where: {
        id: "",
        consignor: ""
      }
      , defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
        title: '提示'
        , layEvent: 'LAYTABLE_TIPS'
        , icon: 'layui-icon-tips'
      }]
      , title: '快递数据表'
      , cols: [[
        {type: 'checkbox', fixed: 'left'}
        , {field: 'id', title: '物流编号', width: 120, fixed: 'left', unresize: true, sort: true}
        , {field: 'consignor', title: '发货人', width: 120, edit: 'text'}
        , {field: 'consigness', title: '收货人', width: 120, edit: 'text'}
        , {field: 'DeliveryPlace', title: '发货地址', width: 240, edit: 'text'}
        , {field: 'ReceiptPlace', title: '收货地址', width: 240, edit: 'text'}
        , {field: 'Status', title: '状态', width: 120, edit: 'text'}

      ]]
      , page: true
    });
    //头工具栏事件
    table.on('toolbar(Member)', function (obj) {
      var checkStatus = table.checkStatus(obj.config.id);
      switch (obj.event) {
        case 'ReLoadTable':
          table.reload('Member', {
            url: 'http://localhost:8081/Express/getAddExpressList'
            , request: {
              pageName: 'page' //页码的参数名称，默认：page
              , limitName: 'limit' //每页数据量的参数名，默认：limit
            }
            , where: {
              id: "",
              consignor: "",
            }
            , page: {
              curr: 1
            }
          });
          break;
        case 'AddExpress':
          layer.open({
            type: 2,
            title: '发货',
            shadeClose: true,
            shade: 0.8,
            area: ['800px', '90%'],
            content: 'addexpress-add.html' //iframe的url
          });
          break;
        case 'LookExpress':
          var data = checkStatus.data;  //获取选中行数据\
          var jsondata=JSON.stringify(data);
          var obj= eval('('+jsondata+')')
          localStorage.setItem("id",obj[0].id)//获取id并储存在localstorage
          layer.open({
            type: 2,
            title: '物流数据',
            shadeClose: true,
            shade: 0.8,
            area: ['580px', '60%'],
            content: 'TimeAxis.html' //iframe的url
          });
          break;
      };
    });
  });

  function reload() {
    var table = layui.table;
    table.reload('Member', {
      url: 'http://localhost:8081/Express/getAddExpressList'
      , request: {
        pageName: 'page' //页码的参数名称，默认：page
        , limitName: 'limit' //每页数据量的参数名，默认：limit
      }
      , where: {
        id: $('#id').val(),
        consigness: $('#consigness').val(),
      }
      , page: {
        curr: 1
      }
    });
  }


</script>
</body>
</html>